# $Id$
# Maintainer: Jan de Groot <jgc@archlinux.org>

pkgname=libvdpau
pkgver=1.1.1+3+ga21bf7a
pkgrel=1
pkgdesc="Nvidia VDPAU library"
arch=(i686 x86_64)
url='https://www.freedesktop.org/wiki/Software/VDPAU/'
depends=('libxext')
license=('custom')
_commit=a21bf7aa438f5dd40d0a300a3167aa3d6f26dccc  # master
source=("git+https://anongit.freedesktop.org/git/vdpau/libvdpau#commit=$_commit")
makedepends=('dri2proto' git)
sha256sums=('SKIP')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/^libvdpau-//;s/-/+/g'
}

prepare() {
  cd $pkgname
  NOCONFIGURE=1 ./autogen.sh
}

check() {
  cd $pkgname
  make check
}

build() {
  cd "${srcdir}/$pkgname"
  ./configure --prefix=/usr --sysconfdir=/etc
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

package() {
  cd "${srcdir}/$pkgname"
  make DESTDIR="${pkgdir}" install

  install -d -m755 "${pkgdir}/usr/share/licenses/${pkgname}"
  install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
}
